package cn.schoolwow.ams.module.block.common.flow;

import cn.schoolwow.ams.domain.block.common.BlockOption;
import cn.schoolwow.ams.module.block.common.domain.BlockContext;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class SetBlockContextFieldValueFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        BlockContext blockContext = flowContext.checkInstanceData(BlockContext.class);
        BlockOption blockOption = flowContext.checkInstanceData(BlockOption.class);

        blockContext.projectName = blockOption.projectName;
        blockContext.displayName = blockOption.displayName;
        blockContext.uniqueKey = blockOption.routerBlock.getBlockUniqueName();
    }

    @Override
    public String name() {
        return "设置BlockContext字段信息";
    }
}
